<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>class & style</title>
  <script src="/vue.js"></script>
  <link rel="stylesheet" href="./style.css">
</head>
<body>
  <div id="root">
    <div 
      :class="[
        {
          title2: isBold,
          title3: true
        }
      ]"
    >
      {{title}}
    </div>
    <div :style="{lineHeight: '60px', color}">
      这是正文
    </div>
    <div>
      <button @click="handleClick">bold</button>
    </div>
  </div>
  <script>
    var vm = new Vue({
      el: '#root',
      data: {
        title: '这是一个标题',
        isBold: false,
        color: '#666'
      },
      methods: {
        handleClick() {
          this.isBold = true
          this.color = '#6435c9'
        }
      },
    })
  </script>
</body>
</html>